using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Suucha.Adsi.Configuration
{
    public class AdsiConfiguration : ConfigurationSection
    {

        public const string SectionName = "adsiConfiguration";

        private const string defaultLdapProperty = "defaultLdap";
        private const string defaultWebProperty = "defaultWeb";
        private const string defaultFtpProperty = "defaultFtp";
        private const string adsiSettingsProperty = "adsiSettings";

        public AdsiConfiguration()
            : base()
        {
        }

        public static AdsiConfiguration GetAdsiSettings()
        {
            return (AdsiConfiguration)System.Configuration.ConfigurationManager.GetSection(SectionName);
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty(defaultWebProperty, IsRequired=true)]
        public string DefaultWeb
        {
            get
            {
                return (string)this[defaultWebProperty];
            }
            set
            {
                this[defaultWebProperty] = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty(defaultFtpProperty, IsRequired=true)]
        public string DefaultFtp
        {
            get
            {
                return (string)this[defaultFtpProperty];
            }
            set
            {
                this[defaultFtpProperty] = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty(defaultLdapProperty, IsRequired=true)]
        public string DefalutLdap
        {
            get
            {
                return (string)this[defaultLdapProperty];
            }
            set
            {
                this[defaultLdapProperty] = value;
            }
        }

        /// <summary>
        /// 
        /// </summary>
        [ConfigurationProperty(adsiSettingsProperty, IsRequired=true)]
        public AdsiSettingsCollection AdsiSettings
        {
            get
            {
                return (AdsiSettingsCollection)this[adsiSettingsProperty];
            }
            set
            {
                this[adsiSettingsProperty] = value;
            }
        }
    }
}
